package example.demo.datasouce;

import com.alibaba.druid.pool.DruidDataSource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;

//@Order(-100)
@Configuration
@Slf4j
public class MutiDatasourceBean {

    @ConfigurationProperties("datasource.rao-db1")
    @Bean
    public DataSource db1() {
        return new DruidDataSource();
    }

    @ConfigurationProperties("datasource.rao-db2")
    @Bean
    public DataSource db2() {
        return new DruidDataSource();
    }

    @ConfigurationProperties("datasource.rao-db3")
    @Bean
    public DataSource db3() {
        return new DruidDataSource();
    }

}
